<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		
		<script>
			
			//国定电话 0755-28014257-1
			//(0\d{2,3}-)?[1-9]\d{7}(-\d{1,4})?
			//区号和分机号可有可无
			
			var str='010-87496698-810';
			var re =/^(0\d{2,3}-)?[1-9]\d{6,7}(-\d{1,4})?$/;
			var arr=str.match(re);
			console.log(arr);
			
			var b = re.test(str);
			console.log(b);
		</script>
	</body>
</html>
